<?php



//if(!$mysqli->query("CREATE TABLE IF NOT EXISTS `books` (
 // `id` int(11) NOT NULL AUTO_INCREMENT,
 // `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
 // `price` double NOT NULL,
 // PRIMARY KEY (`id`)
//) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=14 ;"))
function getFamily()
{
    $mysqli = new mysqli("127.0.0.1", "root", "", "eloquent", 3306);
    if ($mysqli->connect_errno) {
        echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
    }
    $result = $mysqli->query("SELECT * FROM `family`;");
    $family = array();
    $person = $result->fetch_assoc();
    if($person)
    {
        do{
            $family[] = $person;
        }
        while($person = $result->fetch_assoc());
    }
    return json_encode($family);
}